<?php
namespace app\admin\service;
use app\admin\model\SystemSecurity as SecurityModel;

class Security extends BaseService
{
    
	/*
    * 初始
    */
    public function __construct(){
        $this->model = new SecurityModel();
        $this->order = ['id'=>'desc'];
    }
    
    /*
    * 绑定谷歌验证码
    * $data 
    */
    public function bindGoogleCode(String $buss_type,int $buss_id,String $secret){
        $info = $this->getInfo($buss_type,$buss_id);
        if( !$info ){
            throw new \think\Exception( '信息错误！' );
        }
        $info->is_google_auth_bind = 1;
        $info->google_secret = $secret;
        return $info->save();
    }
    
    /*
    * 获取信息
    * $data 
    */
    public function getInfo(String $buss_type,int $buss_id){
       return $this->model->where('buss_type',$buss_type)->where('buss_id',$buss_id)->find();
    }
    
}